package jdk8;

import java.util.*;
import java.util.function.Consumer;

/**
 * @author oldliu
 * @since 1.0
 */
public class MethdRef {
    public static void main(String[] args) {
        //List list=new ArrayList<>();
        //List<String> list2=ArrayList::new;

        List<String> list=new ArrayList<>();
        list.add("老虎");
        list.add("tiger");
        list.add("cat");
        list.add("小猫");
        list.add("pig");
        list.forEach(System.out::println);
        //list.forEach(list::remove);
        System.out.println("-----------------------------");
        list.forEach(x->{
            System.out.println(x);
        });
        Map m=new HashMap();
        m.put("dog","小狗");
        m.put("cat","小猫");
        m.forEach((x,y)->{
            System.out.println(x+"-=-"+y);
            if(y.equals("小猫")){
                System.out.println("-----"+x);
            }
        });
        System.out.println(">>>>>>>>>>>>");
        Consumer<String> c=(x)->{
            //操作
            System.out.println(x.toUpperCase());
        };
        System.out.println(c.getClass().getName()+"?????????????????????");
        list.forEach(c);

    }
}
